<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
<script>
 /*
  =>  3.1 js基本的数据类型 
      null,boolean,undefined,string,number,Symobl

  => 3.2 js有集中类型的值
 */

</script>

<script>
  var arr = [
    {name:'zopp',age:0},
    {name:'gpp',age:18},
    {name:'yjj',age:8}
];

function compare(property){
    return function(a,b){
        var value1 = a[property];
        var value2 = b[property];
        console.log(value1,value2);
        return value1 - value2;
    }
}
console.log(arr.sort(compare('age')))
</script>

</html>